package org.mog.album.controller;

import entity.pojo.Album;
import entity.resullt.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.mog.album.service.IAlbumService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user/album")
@RequiredArgsConstructor
@Slf4j
@Api(tags = "专辑相关接口")
public class AlbumController {
    private final IAlbumService albumService;

    /**
     * 根据id查询专辑
     *
     * @param id
     * @return
     */
    @ApiOperation("根据id查询专辑")
    @GetMapping("/{id}")
    public Result<Album> getById(@PathVariable String id) {
        log.info("根据id查询专辑：{}", id);
        Album album = albumService.getById(id);
        log.info("查询成功：{}", album);
        return Result.success(album);
    }
}

